<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.8.0">
    
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-83895646-2', 'auto');
ga('send', 'pageview');
</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
<!-- End Google Analytics -->


    

    
<!-- Baidu Tongji -->
<script>var _hmt = _hmt || []</script>
<script async src="//hm.baidu.com/hm.js?c199e990e3c84b0b1047773457ba7222"></script>
<!-- End Baidu Tongji -->




    <meta charset="utf-8">
    
    <meta name="google-site-verification" content="google0706f42c5c9ccd5b.html">
    
    
    
    
    <title>ReviewBoard LDAP 配置 验证失败 python-ldap安装失败 | 逗哥的代码作坊 | 互联网是一门实践性科学</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="ReviewBoard,LDAP,python-ldap">
    <meta name="description" content="ReviewBoard配置LDAP无效之前配置代码评审工具选定了淘宝的Tao-ReviewBoard，配合使用Reviewboard 1.6.19的版本。（当前Tao-ReviewBoard发布v1.1.0支持ReviewBoard 1.7） 系统运行在Centos 5.8之上；系统自带Python2.4 升级为Python2.7. openldap直接通过yum安装版本为2.3.43，依赖包及d">
<meta name="keywords" content="ReviewBoard,LDAP,python-ldap">
<meta property="og:type" content="article">
<meta property="og:title" content="ReviewBoard LDAP 配置 验证失败 python-ldap安装失败">
<meta property="og:url" content="http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/index.html">
<meta property="og:site_name" content="逗哥的代码作坊">
<meta property="og:description" content="ReviewBoard配置LDAP无效之前配置代码评审工具选定了淘宝的Tao-ReviewBoard，配合使用Reviewboard 1.6.19的版本。（当前Tao-ReviewBoard发布v1.1.0支持ReviewBoard 1.7） 系统运行在Centos 5.8之上；系统自带Python2.4 升级为Python2.7. openldap直接通过yum安装版本为2.3.43，依赖包及d">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-03-19T03:49:06.910Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="ReviewBoard LDAP 配置 验证失败 python-ldap安装失败">
<meta name="twitter:description" content="ReviewBoard配置LDAP无效之前配置代码评审工具选定了淘宝的Tao-ReviewBoard，配合使用Reviewboard 1.6.19的版本。（当前Tao-ReviewBoard发布v1.1.0支持ReviewBoard 1.7） 系统运行在Centos 5.8之上；系统自带Python2.4 升级为Python2.7. openldap直接通过yum安装版本为2.3.43，依赖包及d">
    
        <link rel="alternate" type="application/atom+xml" title="逗哥的代码作坊" href="/atom.xml">
    
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide">
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">FengDD</h5>
          <a href="mailto:beanmr@gmail.com" title="beanmr@gmail.com" class="mail">beanmr@gmail.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/">
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives">
                <i class="icon icon-lg icon-archives"></i>
                Archives
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags">
                <i class="icon icon-lg icon-tags"></i>
                Tags
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories">
                <i class="icon icon-lg icon-th-list"></i>
                Categories
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/BeanMr" target="_blank">
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="http://www.weibo.com/beanmr" target="_blank">
                <i class="icon icon-lg icon-weibo"></i>
                Weibo
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">ReviewBoard LDAP 配置 验证失败 python-ldap安装失败</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">ReviewBoard LDAP 配置 验证失败 python-ldap安装失败</h1>
        <h5 class="subtitle">
            
                <time datetime="2019-03-19T03:49:06.910Z" itemprop="datePublished" class="page-time">
  2019-03-19
</time>


	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/Tools/">Tools</a></li></ul>

            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap post-toc-shrink" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#ReviewBoard配置LDAP无效"><span class="post-toc-number">1.</span> <span class="post-toc-text">ReviewBoard配置LDAP无效</span></a></li></ol>
        </nav>
    </aside>


<article id="post-2014-8-12-ReviewBorad-LDAP-trobleshooting" class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">ReviewBoard LDAP 配置 验证失败 python-ldap安装失败</h1>
        <div class="post-meta">
            <time class="post-time" title="2019-03-19 11:49:06" datetime="2019-03-19T03:49:06.910Z" itemprop="datePublished">2019-03-19</time>

            
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/Tools/">Tools</a></li></ul>



            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style="display:none">
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h1 id="ReviewBoard配置LDAP无效"><a href="#ReviewBoard配置LDAP无效" class="headerlink" title="ReviewBoard配置LDAP无效"></a>ReviewBoard配置LDAP无效</h1><p>之前配置代码评审工具选定了淘宝的<a href="http://code.taobao.org/p/tao-reviewboard/wiki/index/" target="_blank" rel="noopener">Tao-ReviewBoard</a>，配合使用Reviewboard 1.6.19的版本。（当前Tao-ReviewBoard发布v1.1.0支持ReviewBoard 1.7）</p>
<p>系统运行在Centos 5.8之上；系统自带Python2.4 升级为Python2.7.</p>
<p><code>openldap</code>直接通过<code>yum</code>安装版本为2.3.43，依赖包及devel全部安装（<code>opnldap</code> <code>openldap24-libs</code> <code>openldap-clients</code> <code>openldap-devel</code> <code>openssl-devel</code> <code>libgsasl</code> <code>libgsasl-devel</code>,本机LDAP Server有<code>openldap-servers</code>）。</p>
<p>最近整合LDAP真是各种闹心，但是一旦配置完成的确是很便捷。</p>
<p>配置LDAP过程历经磨难，先后出现了3个问题，记录于此以备后查：</p>
<ol>
<li>python-ldap安装失败</li>
<li>ReviewBoard绑定LDAP失败(问题有点蠢)</li>
<li>ReviewBoard验证LDAP信息失败</li>
</ol>
<p>调试过程<a href="http://www.cnblogs.com/moonson/archive/2009/11/06/1597302.html" target="_blank" rel="noopener">开启openldap日志功能</a></p>
<hr>
<ol>
<li><p>python-ldap安装失败，一直报错头文件异常</p>
<p> 使用<code>yum info python-ldap</code>可以看到系统为python2.4安装了python-ldap，但是在python2.7的site-packages中没有。</p>
</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">easy_install-2.7 install python-ldap</span><br></pre></td></tr></table></figure>
<pre><code>安装一直失败，也参照了网上同学的一些[办法](http://nilm61.iteye.com/blog/1779136)依旧无解，大致的异常如下：
</code></pre><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">extra_compile_args: </span><br><span class="line">extra_objects: </span><br><span class="line">include_dirs: /opt/openldap-RE24/include /usr/include/sasl /usr/include</span><br><span class="line">library_dirs: /opt/openldap-RE24/lib /usr/lib</span><br><span class="line">libs: ldap_r</span><br><span class="line">file Lib/ldap.py (<span class="keyword">for</span> module ldap) not found</span><br><span class="line">file Lib/ldap/controls.py (<span class="keyword">for</span> module ldap.controls) not found</span><br><span class="line">file Lib/ldap/extop.py (<span class="keyword">for</span> module ldap.extop) not found</span><br><span class="line">file Lib/ldap/schema.py (<span class="keyword">for</span> module ldap.schema) not found</span><br><span class="line">warning: no files found matching <span class="string">'Makefile'</span></span><br><span class="line">warning: no files found matching <span class="string">'Modules/LICENSE'</span></span><br><span class="line">file Lib/ldap.py (<span class="keyword">for</span> module ldap) not found</span><br><span class="line">file Lib/ldap/controls.py (<span class="keyword">for</span> module ldap.controls) not found</span><br><span class="line">file Lib/ldap/extop.py (<span class="keyword">for</span> module ldap.extop) not found</span><br><span class="line">file Lib/ldap/schema.py (<span class="keyword">for</span> module ldap.schema) not found</span><br><span class="line">file Lib/ldap.py (<span class="keyword">for</span> module ldap) not found</span><br><span class="line">file Lib/ldap/controls.py (<span class="keyword">for</span> module ldap.controls) not found</span><br><span class="line">file Lib/ldap/extop.py (<span class="keyword">for</span> module ldap.extop) not found</span><br><span class="line">file Lib/ldap/schema.py (<span class="keyword">for</span> module ldap.schema) not found</span><br><span class="line">In file included from Modules/LDAPObject.c:18:</span><br><span class="line">/usr/include/sasl/sasl.h:349: 警告：函数声明不是一个原型</span><br><span class="line">Modules/ldapcontrol.c: In <span class="keyword">function</span> ‘encode_assertion_control’:</span><br><span class="line">Modules/ldapcontrol.c:352: 警告：隐式声明函数 ‘ldap_create_assertion_control_value’</span><br><span class="line">Modules/constants.c: In <span class="keyword">function</span> ‘LDAPinit_constants’:</span><br><span class="line">Modules/constants.c:155: 错误：‘LDAP_OPT_DIAGNOSTIC_MESSAGE’ 未声明 (在此函数内第一次使用)</span><br><span class="line">Modules/constants.c:155: 错误：(即使在一个函数内多次出现，每个未声明的标识符在其</span><br><span class="line">Modules/constants.c:155: 错误：所在的函数内只报告一次。)</span><br><span class="line">Modules/constants.c:365: 错误：‘LDAP_CONTROL_RELAX’ 未声明 (在此函数内第一次使用)</span><br><span class="line">error: Setup script exited with error: <span class="built_in">command</span> <span class="string">'gcc'</span> failed with <span class="built_in">exit</span> status 1</span><br></pre></td></tr></table></figure>
<pre><code>也有网上的童鞋直接修改报错的头文件声明一个变量，虽然编译安装通过但是在实际调用`pytho-ldap`模块过程报错。
最后在Stack Overflow看到[类似问题](http://stackoverflow.com/questions/19311933/redhat-5-4-python-ldap-run-error-python2-7/25199930#25199930)受评论启发，安装python-ldap失败原因是因为`easy_install`自动选择的版本比较新与`CentOS5.8`的`OpenLDAP`不兼容。

解决：
从`python-ldap`的[CVS](http://python-ldap.cvs.sourceforge.net/viewvc/python-ldap/python-ldap/?pathrev=PYLDAP_REL_2_2_1)下载较老的版本，编译安装OK<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">2. 按照表单填写了ReviewBoard的LDAP认证信息，无法通过认证</span><br><span class="line"></span><br><span class="line">    从`openlad`的日志信息来看是ReviewBoard使用了一个错误的用户名密码进行第一次绑定（内网LDAP服务器允许匿名绑定），但是实际我使用的就是匿名绑定，后来发现是浏览器自动缓存了我的ReviewBoard管理员用户名密码用在这里了。很坑爹的故障</span><br></pre></td></tr></table></figure>
</code></pre><ol start="3">
<li><p>LDAP认证正常，依旧无法登陆，报错<code>need more than one value to unpack</code></p>
<p> 问题出在老外的习惯上，ReviewBoard的<code>FullName</code>默认LDAP的attr为displayName，我的服务器的确也是这个规则。最后查询源码发现老外默认从fullname中去解析 <code>sn（surname）</code>和<code>cn（commonname）</code>，而且还是用一个空格分隔。故障<a href="https://github.com/reviewboard/reviewboard/blob/b23dd1f809583f02a5062778ecf0955b8ed9a299/reviewboard/accounts/backends.py" target="_blank" rel="noopener">accounts/backends.py源码</a>如下，注意中间的注释。PS：在这里告诉我，这个小的问题LDAP管理员应该能搞定~~还（KENG）好（DIE）</p>
<p> 解决：删除fullName的配置或者告诉LDAP管理员在displayName中添加空格</p>
</li>
</ol>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">get_or_create_user</span><span class="params">(self, username)</span>:</span></span><br><span class="line">    username = username.strip()</span><br><span class="line"></span><br><span class="line">    <span class="keyword">try</span>:</span><br><span class="line">        user = User.objects.get(username=username)</span><br><span class="line">        <span class="keyword">return</span> user</span><br><span class="line">    <span class="keyword">except</span> User.DoesNotExist:</span><br><span class="line">        <span class="keyword">try</span>:</span><br><span class="line">            <span class="keyword">import</span> ldap</span><br><span class="line">            ldapo = ldap.initialize(settings.LDAP_URI)</span><br><span class="line">            ldapo.set_option(ldap.OPT_REFERRALS, <span class="number">0</span>)</span><br><span class="line">            ldapo.set_option(ldap.OPT_PROTOCOL_VERSION, <span class="number">3</span>)</span><br><span class="line">            <span class="keyword">if</span> settings.LDAP_TLS:</span><br><span class="line">                ldapo.start_tls_s()</span><br><span class="line">            <span class="keyword">if</span> settings.LDAP_ANON_BIND_UID:</span><br><span class="line">                ldapo.simple_bind_s(settings.LDAP_ANON_BIND_UID,</span><br><span class="line">                                    settings.LDAP_ANON_BIND_PASSWD)</span><br><span class="line"></span><br><span class="line">            passwd = ldapo.search_s(settings.LDAP_BASE_DN,</span><br><span class="line">                                    ldap.SCOPE_SUBTREE,</span><br><span class="line">                                    settings.LDAP_UID_MASK % username)</span><br><span class="line"></span><br><span class="line">            user_info = passwd[<span class="number">0</span>][<span class="number">1</span>]</span><br><span class="line"></span><br><span class="line">            given_name_attr = getattr(settings, <span class="string">'LDAP_GIVEN_NAME_ATTRIBUTE'</span>,</span><br><span class="line">                                      <span class="string">'givenName'</span>)</span><br><span class="line">            first_name = user_info.get(given_name_attr, [username])[<span class="number">0</span>]</span><br><span class="line"></span><br><span class="line">            surname_attr = getattr(settings, <span class="string">'LDAP_SURNAME_ATTRIBUTE'</span>, <span class="string">'sn'</span>)</span><br><span class="line">            last_name = user_info.get(surname_attr, [<span class="string">''</span>])[<span class="number">0</span>]</span><br><span class="line"></span><br><span class="line">            <span class="comment"># If a single ldap attribute is used to hold the full name of</span></span><br><span class="line">            <span class="comment"># a user, split it into two parts.  Where to split was a coin</span></span><br><span class="line">            <span class="comment"># toss and I went with a left split for the first name and</span></span><br><span class="line">            <span class="comment"># dumped the remainder into the last name field.  The system</span></span><br><span class="line">            <span class="comment"># admin can handle the corner cases.</span></span><br><span class="line">            <span class="keyword">try</span>:</span><br><span class="line">                <span class="keyword">if</span> settings.LDAP_FULL_NAME_ATTRIBUTE:</span><br><span class="line">                    full_name = user_info[settings.LDAP_FULL_NAME_ATTRIBUTE][<span class="number">0</span>]</span><br><span class="line">                    first_name, last_name = full_name.split(<span class="string">' '</span>, <span class="number">1</span>)</span><br><span class="line">            <span class="keyword">except</span> AttributeError:</span><br><span class="line">                <span class="keyword">pass</span></span><br><span class="line"></span><br><span class="line">            <span class="keyword">if</span> settings.LDAP_EMAIL_DOMAIN:</span><br><span class="line">                email = <span class="string">u'%s@%s'</span> % (username, settings.LDAP_EMAIL_DOMAIN)</span><br><span class="line">            <span class="keyword">elif</span> settings.LDAP_EMAIL_ATTRIBUTE:</span><br><span class="line">                email = user_info[settings.LDAP_EMAIL_ATTRIBUTE][<span class="number">0</span>]</span><br><span class="line">            <span class="keyword">else</span>:</span><br><span class="line">                logging.warning(<span class="string">"LDAP: email for user %s is not specified"</span>,</span><br><span class="line">                                username)</span><br><span class="line">                email = <span class="string">''</span></span><br><span class="line"></span><br><span class="line">            user = User(username=username,</span><br><span class="line">                        password=<span class="string">''</span>,</span><br><span class="line">                        first_name=first_name,</span><br><span class="line">                        last_name=last_name,</span><br><span class="line">                        email=email)</span><br><span class="line">            user.is_staff = <span class="keyword">False</span></span><br><span class="line">            user.is_superuser = <span class="keyword">False</span></span><br><span class="line">            user.set_unusable_password()</span><br><span class="line">            user.save()</span><br><span class="line">            <span class="keyword">return</span> user</span><br><span class="line">        <span class="keyword">except</span> ImportError:</span><br><span class="line">            <span class="keyword">pass</span></span><br><span class="line">        <span class="keyword">except</span> ldap.INVALID_CREDENTIALS:</span><br><span class="line">            <span class="comment"># FIXME I'd really like to warn the user that their</span></span><br><span class="line">            <span class="comment"># ANON_BIND_UID and ANON_BIND_PASSWD are wrong, but I don't</span></span><br><span class="line">            <span class="comment"># know how</span></span><br><span class="line">            <span class="keyword">pass</span></span><br><span class="line">        <span class="keyword">except</span> ldap.NO_SUCH_OBJECT, e:</span><br><span class="line">            logging.warning(<span class="string">"LDAP error: %s settings.LDAP_BASE_DN: %s "</span></span><br><span class="line">                            <span class="string">"settings.LDAP_UID_MASK: %s"</span> %</span><br><span class="line">                            (e, settings.LDAP_BASE_DN,</span><br><span class="line">                             settings.LDAP_UID_MASK % username))</span><br><span class="line">        <span class="keyword">except</span> ldap.LDAPError, e:</span><br><span class="line">            logging.warning(<span class="string">"LDAP error: %s"</span> % e)</span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">None</span></span><br></pre></td></tr></table></figure>
        </div>

        <blockquote class="post-copyright">
    
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2019-03-19T03:49:06.910Z" itemprop="dateUpdated">2019-03-19 11:49:06</time>
</span><br>


        
        本文采用 <a href="https://creativecommons.org/licenses/by/4.0/">CC BY-SA</a> 许可发布，您可以自由的转载分享。<br>转载请保留出处...<br><a href="/2014-8-12-ReviewBorad-LDAP-trobleshooting/" target="_blank" rel="external">http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/</a>
        
    </div>
    
    <footer>
        <a href="http://blog.beanmr.com">
            <img src="/img/avatar.jpg" alt="FengDD">
            FengDD
        </a>
    </footer>
</blockquote>

        


        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/LDAP/">LDAP</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/ReviewBoard/">ReviewBoard</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python-ldap/">python-ldap</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/&title=《ReviewBoard LDAP 配置 验证失败 python-ldap安装失败》 — 逗哥的代码作坊&pic=http://blog.beanmr.com/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/&title=《ReviewBoard LDAP 配置 验证失败 python-ldap安装失败》 — 逗哥的代码作坊&source=" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《ReviewBoard LDAP 配置 验证失败 python-ldap安装失败》 — 逗哥的代码作坊&url=http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/&via=http://blog.beanmr.com" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/2015-1-06-DiveIntoJvm-ObjectMemoryLayout/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">[JVM]深入Java对象内存布局-01-基础工具Unsafe</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/2013-11-28-svnmanager-troubleshooting/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">SVNManager用户和组权限报错</h4>
      </a>
    </div>
  
</nav>



    











    <!-- Valine Comments -->
    <div class="comments vcomment" id="comments"></div>
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <script src="//unpkg.com/valine@latest/dist/Valine.min.js"></script>
    <!-- Valine Comments script -->
    <script>
        var GUEST_INFO = ['nick','mail','link'];
        var guest_info = 'nick,mail,link'.split(',').filter(function(item){
          return GUEST_INFO.indexOf(item) > -1
        });
        new Valine({
            el: '#comments',
            notify: 'false' == 'true',
            verify: 'false' == 'true',
            appId: "li3DyMdVK1kubJOWaSi7XXX6-gzGzoHsz",
            appKey: "XTYDVacuFynCNMJYgQUrn9Ol",
            avatar: "mm",
            placeholder: "简单说两句？？",
            guest_info: guest_info.length == 0 ? GUEST_INFO : guest_info,
            pageSize: "10"
        })
    </script>
    <!-- Valine Comments end -->










</article>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style="display:none">
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style="display:none">
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>FengDD &copy; 2015 - 2019</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/&title=《ReviewBoard LDAP 配置 验证失败 python-ldap安装失败》 — 逗哥的代码作坊&pic=http://blog.beanmr.com/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/&title=《ReviewBoard LDAP 配置 验证失败 python-ldap安装失败》 — 逗哥的代码作坊&source=" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《ReviewBoard LDAP 配置 验证失败 python-ldap安装失败》 — 逗哥的代码作坊&url=http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/&via=http://blog.beanmr.com" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://blog.beanmr.com/2014-8-12-ReviewBorad-LDAP-trobleshooting/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: false };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>






<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>



<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '逗哥等你回来';
            clearTimeout(titleTime);
        } else {
            document.title = '(つェ⊂)咦!回来啦!';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



</body>
</html>
